package es.uji.viselab;

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 * Starts the swing user interface of the ViSeLab tool. The only JPanel that
 * creates inside is the menu (ViSeLabMainMenu)
 * 
 * @author Roger Esteller
 * @see ViSeLabMainMenu
 * 
 */
public class ViSeLabStarter {

	protected static ViSeLabMainMenu vsi;

	public static void main(String args[]) {
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				createAndShowGUI();
			}
		});
	}

	private static void createAndShowGUI() {

		JFrame windowFrame = new JFrame("Visual Servoing Laboratory (ViSeLab) v 0.3");
		Container contentPane = windowFrame.getContentPane();
		contentPane.setPreferredSize(new Dimension(1250,550));
		
		BackgroundImagePanel background = new BackgroundImagePanel(new ImageIcon("/Users/roger/Documents/workspace/ViSeLab/images/background_1222x505.png").getImage());
		contentPane.add(background);
		  
		vsi = new ViSeLabMainMenu(windowFrame);
		JComponent mainMenu = vsi.getMainMenu();
		
		contentPane.add(mainMenu);
		windowFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   
		
		windowFrame.pack();
		windowFrame.setVisible(true);
	//	windowFrame.repaint();
	//	windowFrame.pack();
	//	windowFrame.setVisible(true);
		
	}

}
